Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor event pipeline to accept typed event payloads #38276

Closed
wants to merge 1 commit into from

Conversation

vincentriemer
Copy link
Contributor

Summary:
Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't need to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: D47299631

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jul 10, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 10, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: D47299631

fbshipit-source-id: a97e5c2c3397cda83cf151d98324c8c1534ffc5b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 10, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: D47299631

fbshipit-source-id: 4eaa16753490a077908dadf48aded1481bb646b0
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

@analysis-bot
Copy link

analysis-bot commented Jul 10, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,832,540 +704
android hermes armeabi-v7a 8,141,121 +502
android hermes x86 9,336,849 +596
android hermes x86_64 9,179,617 +712
android jsc arm64-v8a 9,445,425 +696
android jsc armeabi-v7a 8,626,571 +485
android jsc x86 9,527,554 +606
android jsc x86_64 9,771,013 +712

Base commit: f396067
Branch: main

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 10, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: D47299631

fbshipit-source-id: 91c1fbf8af18bf217754f6560a00764712c1d5b6
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 10, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: 5be5e970434e1c0a410a8ff0a2924493b580432e
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: 0fdc3aed5fdb1044578afc237c3f61a18c199576
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Reviewed By: NickGerleman

Differential Revision: D47299631

fbshipit-source-id: ff2301ab5da3abe0119920b943f5f20439885bf4
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: 7cd7f495573bed133c606820896692b58c0696c2
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Reviewed By: NickGerleman

Differential Revision: D47299631

fbshipit-source-id: 71641243599eb639cb38f93617fe5cc2243a4721
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: ca55217a84e841e1ff0d026f7b1bc8da026ab5a6
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Reviewed By: NickGerleman

Differential Revision: D47299631

fbshipit-source-id: d423966eeddd9c00cd48e6472024854aa4c0a251
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: 47eeece8e4e900be24016e62dff66569b68332e3
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: a5b3eeac44dd4a3095d7359e0a980029f92e75d8
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: ce4bb79ded9e60ba10948ac56b5b16fcabab3d17
vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Reviewed By: NickGerleman

Differential Revision: D47299631

fbshipit-source-id: 325bea1bbb9dc785da68f9df7099a57ed2b28167
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Reviewed By: NickGerleman

Differential Revision: D47299631

fbshipit-source-id: ede531a4937d990ddfe0a7da63d72032871edb90
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47299631

vincentriemer added a commit to vincentriemer/react-native that referenced this pull request Jul 11, 2023
Summary:
Pull Request resolved: facebook#38276

Changelog: [Internal] Refactor Fabric event pipeline to accept typed event payloads

As a first step towards my project of managing the Pointer Capture API by intercepting events in UIManagerBinding I need infrastructure to be able to safely & efficently read the properties of the event payload which is what this diff lays the ground work of addressing.

Currently the events are passed from the EventEmitter all the way to UIManagerBinding with only a ValueFactory (std::function lambda) which is called to produce the jsi::Value. My diff introduces a new virtual base class, EventPayload, which provides the same functionality but in a member function, asJSIValue. To ease the transition to this new paradigm I also introduce the first concrete subclass of EventPayload: ValueFactoryEventPayload — which simply stores and calls a ValueFactory so that we can incrementally migrate to typed events (or frankly, continue to be used for events that we don't *need* to be typed, as the only real use-case in the beginning will be for Pointer Events).

This diff notably does not change any behavior and should behave the exact same way it did before — it is in later diffs where I will begin applying this to the pointer events.

Differential Revision: https://internalfb.com/D47299631

fbshipit-source-id: f077859100ee8f336a66a1747551092a4b3fe25a
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 11, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ffc68ff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants